package almacenes.controlador.gestionar;

import java.util.List;

import javax.faces.model.ListDataModel;

import org.primefaces.model.SelectableDataModel;

import almacenes.modelo.dto.GuiaNoConformeDto;

/**
 * @author Hildebrando
 *
 */
public class GuiaNoConformeTabla extends ListDataModel<GuiaNoConformeDto>
		implements SelectableDataModel<GuiaNoConformeDto> {
	
	 public GuiaNoConformeTabla() {  
	    }  
	  
	    public GuiaNoConformeTabla(List<GuiaNoConformeDto> objGuiaNoConformeDto) {  
	        super(objGuiaNoConformeDto);  
	    } 
	    
	@SuppressWarnings("unchecked")
	public GuiaNoConformeDto getRowData(String rowKey) {
		List<GuiaNoConformeDto> lstGuiaNoConformeDto = (List<GuiaNoConformeDto>) getWrappedData();

		for (GuiaNoConformeDto objGuiaNoConformeDto : lstGuiaNoConformeDto) {
			if (objGuiaNoConformeDto.getiIdGuia() == Integer.valueOf(rowKey)) {
				return objGuiaNoConformeDto;
			}
		}
		return null;
	}

	@Override
	public Object getRowKey(GuiaNoConformeDto objGuiaNoConformeDto) {
		return objGuiaNoConformeDto.getiIdGuia();
	}
}
